package com.example.web.controller;

import com.example.model.RestResult;
import com.example.web.swagger.ILoginController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

@RestController
public class LoginController implements ILoginController {

    @GetMapping("/login1")

    public Map<String, Object> login1(
            @RequestParam("username") String username,
            @RequestParam("password") String password) {

        Map<String, Object> map = new LinkedHashMap<>();
        map.put("code", 200);
        map.put("msg", "success");

        return map;
    }

    @PostMapping("/login2")
    public RestResult<Void> login2(
            @RequestParam("username") String username,
            @RequestParam("password") String password) {

        RestResult<Void> result = new RestResult<>(200L, "success", null);

        return result;
    }
}
